const SUMMARY_ICON_SIZE = 48;
+// Lightbox fading times
+// STANDARD_FADE_TIME is used when the session goes idle, while
+// SHORT_FADE_TIME is used when requesting lock explicitly from the user menu
+const STANDARD_FADE_TIME = 10;
+const SHORT_FADE_TIME = 2;
+
const Clock = new Lang.Class({
Name: 'ScreenShieldClock',
this._hasLockScreen = false;
this._lightbox = new Lightbox.Lightbox(Main.uiGroup,
- { inhibitEvents: true, fadeInTime: 10, fadeFactor: 1 });
+ { inhibitEvents: true,
+ fadeInTime: STANDARD_FADE_TIME,
+ fadeFactor: 1 });
},
_onLockScreenKeyRelease: function(actor, event) {
let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
if (shouldLock || this._isLocked) {
- this.lock();
+ this.lock(false);
} else if (this._isModal) {
this.unlock();
}
},
showDialog: function() {
- this.lock();
+ this.lock(true);
this._showUnlockDialog(false);
},
this._dialog.destroy();
this._dialog = null;
- this._resetLockScreen();
+ this._resetLockScreen(false);
},
_onUnlockSucceded: function() {
this._lockScreenGroup.hide();
},
- _resetLockScreen: function() {
+ _resetLockScreen: function(animate) {
+ if (animate) {
+ this.actor.opacity = 0;
+ Tweener.removeTweens(this.actor);
+ Tweener.addTween(this.actor,
+ { opacity: 255,
+ time: SHORT_FADE_TIME,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ this.emit('lock-screen-shown');
+ },
+ onCompleteScope: this
+ });
+ } else {
+ this.emit('lock-screen-shown');
+ }
+
this._lockScreenGroup.fixed_position_set = false;
this._lockScreenGroup.show();
this._arrow.show();
this.emit('lock-status-changed', false);
},
- lock: function() {
+ lock: function(animate) {
if (!this._hasLockScreen)
this._prepareLockScreen();
this._isLocked = true;
this.actor.show();
- this._resetLockScreen();
+ this._resetLockScreen(animate);
this.emit('lock-status-changed', true);
},
_onLockScreenActivate: function() {
Main.overview.hide();
- Main.screenShield.lock();
+ Main.screenShield.lock(true);
},
_onLoginScreenActivate: function() {
Main.overview.hide();
- Main.screenShield.lock();
+ Main.screenShield.lock(false);
this._userManager.goto_login_session();
},
this._suspendOrPowerOffItem.state == PopupMenu.PopupAlternatingMenuItemState.DEFAULT) {
this._session.ShutdownRemote();
} else {
- Main.screenShield.lock();
- this._upClient.suspend_sync(null);
+ let tmpId = Main.screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
+ Main.screenShield.disconnect(tmpId);
+
+ this._upClient.suspend_sync(null);
+ }));
+
+ Main.screenShield.lock(true);
}
}
});